package com.tools.sqlmaker.make.impl;

import com.tools.sqlmaker.entry.OrgInfo;
import com.tools.sqlmaker.make.BaseMaker;

import java.util.ArrayList;
import java.util.List;


/**
 * @author: zhoubin
 * @date: 2023/9/7
 */
public abstract class GatewayBaseMaker extends BaseMaker {

    OrgInfo orgInfo;

    /**
     * 节点编码
     */
    private String nodeCode;

    /**
     * 单元编码
     */
    private String unitCode;

    /**
     * 队列管理器编码前缀
     */
    private String qmCodePre;

    GatewayBaseMaker(OrgInfo info) {
        this.orgInfo = info;
        this.nodeCode = info.getOrgBic() + "_" + info.getSysCode();
        this.unitCode = nodeCode + "_A";
        this.qmCodePre = unitCode + "_" + info.getQType() + "_";
        setDataBase(info.getDataBase());
    }

    public String getNodeCode() {
        return nodeCode;
    }

    public String getUnitCode() {
        return unitCode;
    }

    public String getQmCodePre() {
        return qmCodePre;
    }

    public OrgInfo getOrgInfo() {
        return orgInfo;
    }

    List<String> getSysQmCodeList() {
        OrgInfo info = getOrgInfo();
        List<String> qmCodeList = new ArrayList<String>() {{
            add("CIPSCNSHXXX_CCGW_" + info.getDcCode() + "_" + info.getQType() + "_A");
            add("CIPSCNSHXXX_CCGW_" + info.getDcCode() + "_" + info.getQType() + "_B");
        }};

        return qmCodeList;
    }
}
